function HandleSearchTask(gui, item, options) {
  this._gui = gui;
  this._item = item;
  this._options = options;
  this._popupBox = new PopupBox();
  
  this._callbackFunc = (options && options.callbackFunc) ? options.callbackFunc : function() {};
  this._query = (options && options.query) ? options.query : '1=1';

  this._createElements();
}

HandleSearchTask.prototype._createElements = function() {
  var _self = this;
  this._gui.customerId.onkeypress = function(e) { var code = DOMUtils.getEventCode(e);
                                                  if (code == 13) {
                                                    _self._callbackFunc(escape((_self._gui.customerId.value != '') ? '(d.customerId = ' + _self._gui.customerId.value + ')' : '1 = 1') + ' AND ' + ((_self._gui.task.value != '') ? DlmanageUtils.lookup(_self._gui.task.value, Manage.array()) : '1 = 1'));
                                                  }
                                                };
  this._gui.customerId.onkeyup = function() { if (_self._gui.customerId.value.length == 0) {
                                                _self._popupBox._close();
                                              } else {
                                                var div = document.createElement('div');
                                                var pos1 = DOMUtils.findPos(_self._gui.customerId);
                                                var pos = [pos1[0] + 1, pos1[1] + 82];
                                                var query = "SELECT DISTINCT d.customerId as customerId FROM ns_Produce as d WHERE " + _self._query + " AND " + '((d.customerId LIKE \'%' + _self._gui.customerId.value + '%\'))' + " ";
                                                MiscUtils.dialog(_self._popupBox, pos, div, null, null, {pop: true});
                                                new DialogSearchResult(div, _self._gui.customerId, { query: query, popupBox: _self._popupBox, callbackFunc: function() { _self._createElements();}, php: Constant.FACTORY + '/customphp/mysqlcustom.php', width: 100});
                                              }
                                            };
  
  this._gui.task.onkeypress = function(e) { var code = DOMUtils.getEventCode(e);
                                            if (code == 13) {
                                              _self._callbackFunc(escape((_self._gui.customerId.value != '') ? '(d.customerId = ' + _self._gui.customerId.value + ')' : '1 = 1') + ' AND ' + ((_self._gui.task.value != '') ? DlmanageUtils.lookup(_self._gui.task.value, Manage.array()) : '1 = 1'));
                                            }
                                          };
  this._gui.task.onkeyup = function() { if (_self._gui.task.value.length == 0) {
                                          _self._popupBox._close();
                                        } else {
                                          var div = document.createElement('div');
                                          var pos1 = DOMUtils.findPos(_self._gui.task);
                                          var pos = [pos1[0] + 1, pos1[1] + 82];
                                          var query = "SELECT DISTINCT d.pi_model as model FROM ns_Produce as d WHERE " + _self._query + " ";
                                          MiscUtils.dialog(_self._popupBox, pos, div, null, null, {pop: true});
                                          new DialogSearchResult(div, _self._gui.task, { query: query, popupBox: _self._popupBox, callbackFunc: function() { _self._createElements(); }, php: Constant.FACTORY + '/customphp/mysqlcustom.php', isTask: true, width: 290 });
                                        }
                                      };
 
  this._gui.button.onclick = function() { _self._callbackFunc(escape((_self._gui.customerId.value != '') ? '(d.customerId = ' + _self._gui.customerId.value + ')' : '1 = 1') + ' AND ' + ((_self._gui.task.value != '') ? DlmanageUtils.lookup(_self._gui.task.value, Manage.array()) : '1 = 1')); };
};

HandleSearchTask.prototype._changeDate = function(label, currentDate, onChangeFunc, showTime) {
  var _self = this;
  this._wContainer = document.createElement('div');
  this._wContainer.style.left = DOMUtils.findPos(label)[0] + 'px';
  this._wContainer.style.top = DOMUtils.findPos(label)[1] + 'px';
  this._popupBox._open(this._wContainer, { pos: DOMUtils.findPos(label) });
  
  var ds = new DateSelect(currentDate, null, { container: this._wContainer, showTime: showTime });
  ds._selectFunc = function(sd) { _self._selectDate.call(_self, sd, label, onChangeFunc, showTime); };
};

HandleSearchTask.prototype._selectDate = function(sd, label, onChangeFunc, showTime) {
  
  onChangeFunc(sd);
  this._showDate(sd, label, showTime);
  this._popupBox._close();
};

HandleSearchTask.prototype._showDate = function(sd, label, showTime) {
  if (sd) { 
    label.value = SimpleDate.format(sd, showTime);
  } else {
    label.value = '';
  }
};